package com.wuzheng.wisgo.sanitation.devtools.service;

import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.wuzheng.wisgo.sanitation.framework.util.StringUtils;

import java.util.List;

/**
 * @author：hibon
 * @date：Created in 2019/08/17
 * @description：
 * @modified By：
 * @version: 1.0
 */
public class EntityNameRewriter extends InjectionConfig {

    private String entityName;

    public String getEntityName() {
        return entityName;
    }

    public void setEntityName(String entityName) {
        this.entityName = entityName;
    }

    @Override
    public void initMap() {
        if(StringUtils.isNotEmpty(entityName)){
            List<TableInfo> tableInfoList = this.getConfig().getTableInfoList();
            if(tableInfoList != null){
                tableInfoList.get(0).setComment(entityName);
            }
        }
    }
}
